package com.xk.school_device.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xk.school_device.common.Result;
import com.xk.school_device.entity.Maintenances;
import com.xk.school_device.mapper.MaintenancesMapper;
import com.xk.school_device.service.IMaintenancesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xk
 * @since 2025-04-16
 */
@Service
public class MaintenancesServiceImpl extends ServiceImpl<MaintenancesMapper, Maintenances> implements IMaintenancesService {

    @Override
    public Result getMaintenanceRecords(Integer page, Integer pageSize) {
        PageHelper.startPage(page,pageSize);
        List<Maintenances> maintenances= getBaseMapper().getMaintenanceRecords();
        PageInfo<Maintenances> maintenancesPageInfo = new PageInfo<>(maintenances);
        return Result.success(maintenancesPageInfo);
    }

    @Override
    public Result getMaintenanceFinishs(Integer page, Integer pageSize) {
        PageHelper.startPage(page,pageSize);
        List<Maintenances> maintenances= getBaseMapper().getMaintenanceFinishs();
        PageInfo<Maintenances> maintenancesPageInfo = new PageInfo<>(maintenances);
        return Result.success(maintenancesPageInfo);
    }
}
